Reading layer `infant' from data source `E:\ADI BUANA\SEMESTER 7\PETA JATIM 2017 AKB\infant.shp' using driver `ESRI Shapefile'
Simple feature collection with 38 features and 13 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 110.8984 ymin: -8.780764 xmax: 116.2634 ymax: -5.527337
epsg (SRID):    NA
proj4string:    NA

Interactive Data Visualization

Row

IMR

Total Health Facility in East Java

960

Highest IMR East Java Province

56.13

Highest Poverty East Java

24.11

Row

Top IMR East Java

Top Poverty East Java

Scatter Plot

Row

IMR Vs Poverty

IMR Vs Health Facility

IMR East Java

Row

IMR East Java by City and Regency

IMR Indonesia by Province

Map IMR

Row

IMR East Java

Interactive Map IMR

Data Table

Summary

Column

Highest IMR

56.13

Lowest IMR

15.6

Highest Poverty

24.11

Lowest Poverty

4.33

Total Health Facilities

960

Column

Report

  • The highest IMR in East Java was Probolinggo with 56.13 percent.

  • The lowest IMR in East Java is Blitar City with 15.6 percect.

  • The highest Poverty in East Java is Sampang with 24.11 percent.

  • The lowest Poverty in East Java is Blitar City with 4.33 percent.

  • The Total Health Facilities in East Java was 960.

This report was generated on October 22, 2019.

About Report

Created by : Antonito (Majoring in Statistics and Minoring in Business Analytics [] )

---
title: "DASHBOARD"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    social: [ "twitter", "facebook","instagram", "menu"]
    source_code: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(sf)
library(ggplot2)
library(tmap)
library(tmaptools)
library(leaflet)
library(tidyverse)
library(plotly)
library(hrbrthemes)
library(kableExtra)
library(DT)
```


```{r directory, echo=FALSE, message=FALSE}
setwd("E:/ADI BUANA/SEMESTER 7/PETA JATIM 2017 AKB")
mydata <- readr::read_csv("infant_jatim.csv")
map <- st_read("E:/ADI BUANA/SEMESTER 7/PETA JATIM 2017 AKB/infant.shp", stringsAsFactors = FALSE)

df = read.csv("E:\\ADI BUANA\\project\\jurnal\\infant.csv", sep = ";")

```


```{r import, echo=FALSE, warning=FALSE}

map_dan_data <- merge(map,mydata)

```


```{r}
mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange")
```

Interactive Data Visualization
=====================================

Row
-------------------------------------

### **IMR**

```{r}
gauge(mydata$IMR,
      min = 0,
      max = 57,
      symbol = "%",
      gaugeSectors(success = c(0, 20),
                   warning = c(21, 40),
                   danger = c(41, 57),
                   colors = c("green", "yellow", "red")))
```


### Total Health Facility in East Java

```{r}
valueBox(sum(mydata$PUSKEMAS),
         icon = 'fa-hospital-o')
```

### Highest IMR East Java Province

```{r}
valueBox(max(mydata$IMR),
         icon = 'fa-area-chart')
```

### Highest Poverty East Java

```{r}
valueBox(max(mydata$MISKIN),
         icon = 'fa-area-chart')
```

Row
-------------------------------------

### Top IMR East Java

```{r}
g1 <- mydata %>%
         group_by(NAMA_KAB) %>%
         filter(IMR > 45) %>%
         plot_ly(labels = ~NAMA_KAB,
                 values = ~IMR,
                 marker = list(colors = mycolors)) %>%
         add_pie(hole = 0.4) %>%
         layout(xaxis = list(zeroline = F,
                             showline = F,
                             showticklabels = F,
                             showgrid = F),
                yaxis = list(zeroline = F,
                             showline = F,
                             showticklabels=F,
                             showgrid=F))
g1
```


### Top Poverty East Java

```{r}
g2 <- mydata %>%
         group_by(NAMA_KAB) %>%
         filter(MISKIN > 16) %>%
         plot_ly(labels = ~NAMA_KAB,
                 values = ~MISKIN,
                 marker = list(colors = mycolors)) %>%
         add_pie(hole = 0.4) %>%
         layout(xaxis = list(zeroline = F,
                             showline = F,
                             showticklabels = F,
                             showgrid = F),
                yaxis = list(zeroline = F,
                             showline = F,
                             showticklabels=F,
                             showgrid=F))
g2
```

Scatter Plot
======================================

Row
--------------------------------------

### IMR Vs Poverty

```{r}
f1 <- plot_ly(mydata, x= ~ MISKIN) %>%
         add_markers(y = ~ IMR,
                     text = ~paste("IMR: ", IMR),
                     showlegend = F) %>%
         add_lines(y = ~fitted(loess(IMR ~ MISKIN)),
                   name = "Loess Smoother",
                   color = I("#FFC125"),
                   showlegend = T,
                   line = list(width=3)) %>%
         layout(xaxis = list(title = "Poverty"),
                yaxis = list(title = "IMR"))
f1
```


### IMR Vs Health Facility

```{r}
f2 <- plot_ly(mydata, x= ~ PUSKEMAS) %>%
         add_markers( y = ~ IMR,
                     text = ~paste("IMR: ", IMR),
                     showlegend = F) %>%
         add_lines(y = ~fitted(loess(IMR ~ PUSKEMAS)),
                   name = "Loess Smoother",
                   color = I("green"),
                   showlegend = T,
                   line = list(width=3)) %>%
         layout(xaxis = list(title = "Health Facility"),
                yaxis = list(title = "IMR"))
f2
```


IMR East Java
=======================================

Row
---------------------------------------
### IMR East Java by City and Regency

```{r}
p1 <- mydata %>%
  filter(!is.na(IMR)) %>%
  arrange(as.ordered(IMR)) %>%
  mutate(NAMA_KAB = factor(NAMA_KAB, NAMA_KAB)) %>%
  ggplot(aes(x = NAMA_KAB, y = IMR)) +
  labs (title = "Infant Mortality Rate East Java" , x = " ", y = " ", subtitle = " IMR East Java 2016 ", caption = "Source : Central Bureau Statistic | Plot generate by : Antonito HC" ) +
  geom_bar(stat = "identity", fill = "brown") +
  coord_flip() +
  theme_ipsum()

ggplotly(p1)
```


### IMR Indonesia by Province

```{r}
p2 <- df %>%
  filter(!is.na(IMR)) %>%
  arrange(as.ordered(IMR)) %>%
  mutate(Provinsi = factor(Provinsi, Provinsi)) %>%
  ggplot(aes(x = Provinsi, y = IMR)) +
  labs (title = "Infant Mortality Rate Indonesia" , 
        x = " ", y = " % IMR ", subtitle = " IMR Indonesia 2016 ", caption = "Source : Central Bureau Statistic | Plot generate by : Antonito HC" ) +
  geom_bar(stat = "identity", fill = "red") +
  coord_flip() +
  theme_ipsum()

ggplotly(p2)
```

Map IMR
=====================================

Row
-------------------------------------
### IMR East Java

```{r}
tm_shape(map_dan_data) + tm_fill("IMR", id = "NAMA_KAB", style = "quantile", n = 4,  palette = "Accent") + tm_borders(alpha = .6) + tm_layout(title = "East Java, Indonesia", legend.text.size = 1.1, legend.title.size = 1.4, legend.position = c("right", "top"), frame = FALSE) 
```


```{r}
tmap_mode("view")
```

### Interactive Map IMR

```{r interactive, comment="", message=F, warning=F}
tmap_last()
```


Data Table
========================================

```{r}
datatable(mydata,
          caption = "IMR 2016",
          rownames = T,
          filter = "top",
          options = list(pageLength = 5))
```



Summary {data-orientation=columns} 
===========================================

Column 
-----------------------------------

### Highest IMR

```{r}
valueBox(max(mydata$IMR),
         icon = "fa-area-chart" )
```

### Lowest IMR


```{r}
valueBox(min(mydata$IMR),
         icon = "fa-area-chart" )
```


### Highest Poverty


```{r}
valueBox(max(mydata$MISKIN),
         icon = "fa-area-chart" )
```


### Lowest Poverty


```{r}
valueBox(min(mydata$MISKIN),
         icon = "fa-area-chart" )
```

### Total Health Facilities
```{r}

valueBox(sum(mydata$PUSKEMAS),
         icon = "fa-building")
```


Column
---------------------------

Report

* The highest IMR in East Java was Probolinggo with  `r max(mydata$IMR)` percent.

* The lowest IMR in East Java is Blitar City  with `r min(mydata$IMR)` percect.

* The highest Poverty in East Java is Sampang with  `r max(mydata$MISKIN)` percent.

* The lowest Poverty in East Java is Blitar City with `r min(mydata$MISKIN)` percent.

* The Total Health Facilities in East Java was `r sum(mydata$PUSKEMAS)`.

This report was generated on `r format(Sys.Date(), format = "%B %d, %Y")`.

About Report
========================================

Created by : Antonito (Majoring in Statistics and Minoring in Business Analytics [antowilcoxon@gmail.com] )